let path = require('path');
let webpack = require('webpack');

module.exports = {
    mode: 'development',
    entry: {
        react: ['react', 'react-dom']
    },
    output: {
        // 新建库的名称
        library: 'react_dll',
        filename: 'react_dll.js',
        path: path.resolve('dist')
    },
    devServer: {
        contentBase: 'dist',
    },
    plugins: [
        // 能把第三方库代码分离开，并且每次文件更改的时候，它只会打包该项目自身的代码。
        new webpack.DllPlugin({
            name: 'react_dll',
            // 让 DllReferencePlugin 映射到相关的依赖上去的。
            path: path.resolve(__dirname, 'dist', 'react_manifest.json')
        })
    ]
}